<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:client='http://wlm.com.mx/SAI/cliente'>
  <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  <xsl:decimal-format name="dollar"
decimal-separator="." grouping-separator=","/>
  <xsl:template match="//client:Cliente">
    <link href="http://localhost:50860/XMLCss/cotizacionPantalla.css" rel="stylesheet" type="text/css" />


    <div id="ContenedorCotizacion">
      <div style="display:block; width:1000px;">
        <div>
          <div id="NombreCliente">
            Cliente No. <xsl:value-of select="@id"/>  - <xsl:value-of select="@NombreComercial"/> - <xsl:value-of select="@RazonSocial"/>
          </div>
        </div>

        <div>

          <div style="width:280px; float:left;" id="ContenedorCotizacion2">

            <div id="DatosCliente">
              <table id="meta">
                <tbody>
                  <tr>
                    <td class="meta-head">R. Social</td>
                    <td>
                      <xsl:value-of select="@RazonSocial"/>

                    </td>
                  </tr>
                  <tr>
                    <td class="meta-head">N. Comercial</td>
                    <td>
                      <xsl:value-of select="@NombreComercial"/>
                    </td>
                  </tr>
                  <xsl:if test="@RepresentanteLegal!=''">
                    <tr>
                      <td class="meta-head">R. Legal</td>
                      <td>
                        <div class="due">
                          <xsl:value-of select="@RepresentanteLegal"/>
                        </div>
                      </td>
                    </tr>
                  </xsl:if>
                  <tr>
                    <td class="meta-head">RFC</td>
                    <td>

                      <xsl:value-of select="@RFC"/>

                    </td>
                  </tr>
                  <xsl:apply-templates select="//client:DireccionFacturacion"/>

                  <xsl:apply-templates select="//client:DireccionEnvio"/>
                  <tr>
                    <td class="meta-head">Telefono</td>
                    <td>
                      <xsl:value-of select="@Telefono"/>
                    </td>
                  </tr>
                  <xsl:if test="@Telefono2!=''">
                    <tr>
                      <td class="meta-head">Telefono 2</td>
                      <td>
                        <xsl:value-of select="@Telefono2"/>
                      </td>
                    </tr>
                  </xsl:if>
                  <xsl:if test="@Telefono3!=''">
                    <tr>
                      <td class="meta-head">Telefono 3</td>
                      <td>
                        <xsl:value-of select="@Telefono3"/>
                      </td>
                    </tr>
                  </xsl:if>
                  <xsl:if test="@FAX!=''">
                    <tr>
                      <td class="meta-head">FAX</td>
                      <td>

                        <xsl:value-of select="@FAX"/>

                      </td>
                    </tr>
                  </xsl:if>
                  <xsl:if test="@Email!=''">
                    <tr>
                      <td class="meta-head">Email</td>
                      <td>

                        <xsl:value-of select="@Email"/>

                      </td>
                    </tr>
                  </xsl:if>
                  <xsl:if test="@WebSite!=''">
                    <tr>
                      <td class="meta-head">WebSite</td>
                      <td>

                        <xsl:value-of select="@WebSite"/>

                      </td>
                    </tr>
                  </xsl:if>
                  <tr>
                    <td class="meta-head">Saldo Actual</td>
                    <td>

                      $<xsl:value-of select="format-number(@SaldoActual, '#,##0.00','dollar')"/>

                    </td>
                  </tr>
                  <tr>
                    <td class="meta-head">L. de Credito</td>
                    <td>

                      $<xsl:value-of select="format-number(@LimiteCredito, '#,##0.00','dollar')"/>

                    </td>
                  </tr>

                  <tr>
                    <td class="meta-head">Categoria</td>
                    <td>
                      <xsl:value-of select="@NombreCategoria"/>
                    </td>
                  </tr>

                  <tr>
                    <td class="meta-head">Vendedor</td>
                    <td>
                      <xsl:value-of select="@NombreVendedor"/>
                    </td>
                  </tr>
                  <tr>
                    <td class="meta-head">C. Pago</td>
                    <td>
                      <xsl:value-of select="@NombreCondicionesPago"/>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <div style="width:360px; float:left;">
            
              <table id="TableCotCliente">
              </table>
              <div id="pagerTableCotCliente"></div>
            </div>
          <div style="width:350px; float:left; margin-left:5px;">
              <table id="TablePagosCliente" style="margin-top:15px;">
              </table>
              <div id="pagerTablePagosCliente"></div>
            <div style="margin-top:5px;">
            <table id="TablePagosCliente1" style="margin-top:15px;">
              </table>
              <div id="pagerTablePagosCliente1"></div>
            </div>          </div>
        </div>
      </div>


    </div>

  </xsl:template>

  <xsl:template match="//client:DireccionFacturacion">
    <tr>
      <td class="meta-head">Direccion Facturacion</td>
      <td>
        <xsl:value-of select="@Calle"/><xsl:value-of select="@NumeroExterior"/>-<xsl:value-of select="@NumeroInterior"/><br/>
        <xsl:value-of select="@Colonia"/>,
        <xsl:value-of select="@Ciudad"/><br/>
        <xsl:value-of select="@Municipio"/>, <xsl:value-of select="@Estado"/>, <xsl:value-of select="@CP"/>
      </td>
    </tr>
  </xsl:template>
  <xsl:template match="//client:DireccionEnvio">

    <tr>
      <td class="meta-head">Direccion Envio</td>
      <td>
        <xsl:value-of select="@Calle"/><xsl:value-of select="@NumeroExterior"/>-<xsl:value-of select="@NumeroInterior"/><br/>
        <xsl:value-of select="@Colonia"/>,
        <xsl:value-of select="@Ciudad"/><br/>
        <xsl:value-of select="@Municipio"/>, <xsl:value-of select="@Estado"/>, <xsl:value-of select="@CP"/>
      </td>
    </tr>

  </xsl:template>
  <xsl:template name="FormatDate">
    <xsl:param name="DateTime" />
    <xsl:variable name="year" select="substring($DateTime,1,4)" />
    <xsl:variable name="month-temp" select="substring-after($DateTime,'-')" />
    <xsl:variable name="month" select="substring-before($month-temp,'-')" />
    <xsl:variable name="day-temp" select="substring-after($month-temp,'-')" />
    <xsl:variable name="day" select="substring($day-temp,1,2)" />
    <xsl:variable name="time" select="substring-after($DateTime,'T')" />
    <xsl:variable name="hh" select="substring($time,1,2)" />
    <xsl:variable name="mm" select="substring($time,4,2)" />
    <xsl:variable name="ss" select="substring($time,7,2)" />

    <!-- Long DATE FORMAT -->

    <xsl:value-of select="$day"/>
    <xsl:value-of select="' de '"/>
    <!--January -->
    <!--January 12 -->
    <xsl:choose>
      <xsl:when test="$month = '1' or $month= '01'">
        Enero
      </xsl:when>
      <xsl:when test="$month = '2' or $month= '02'">
        Febrero
      </xsl:when>
      <xsl:when test="$month= '3' or $month= '03'">
        Marzo
      </xsl:when>
      <xsl:when test="$month= '4' or $month= '04'">
        Abril
      </xsl:when>
      <xsl:when test="$month= '5' or $month= '05'">
        Mayo
      </xsl:when>
      <xsl:when test="$month= '6' or $month= '06'">
        Junio
      </xsl:when>
      <xsl:when test="$month= '7' or $month= '07'">
        Julio
      </xsl:when>
      <xsl:when test="$month= '8' or $month= '08'">
        Augosto
      </xsl:when>
      <xsl:when test="$month= '9' or $month= '09'">
        Septiembre
      </xsl:when>
      <xsl:when test="$month= '10'">
        Octubre
      </xsl:when>
      <xsl:when test="$month= '11'">
        Noviembre
      </xsl:when>
      <xsl:when test="$month= '12'">
        Diciembre
      </xsl:when>
    </xsl:choose>
    <xsl:value-of select="' de'"/>
    <!--January 12,-->
    <xsl:value-of select="' '"/>
    <!--January 12, -->
    <xsl:value-of select="$year"/>
    <!--January 12, 2001-->
    <!--
    <xsl:value-of select="' a las '"/><xsl:value-of select="$hh"/><xsl:value-of select="':'"/><xsl:value-of select="$mm"/><xsl:value-of select="':'"/><xsl:value-of select="$ss"/><xsl:value-of select="' (GMT) '"/>-->
    <!-- END: Long DATE FORMAT -->

  </xsl:template>
</xsl:stylesheet>